import HttpRequestAPI from '@/services'
//TS 类型声明

/**
 * 分类数据类型
 */
export interface CategoryInfo {
  categoryId: number
  categoryCode: string
  categoryIdName: string
  pCategoryId: number
  icon: string
  background: string
  sort: number
  children?: CategoryInfo[]
}
export type CategoryList = CategoryInfo[]

/**
 *
 * @param 获取首页的所有分类列表
 * @returns
 */
export const loadAllCategoryHttpRequest = () => {
  return HttpRequestAPI.get<CategoryList>({
    url: '/web/category/loadAllCategory',
    data: { showLoading: true }
  })
}
